<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>写留言</title>
    <meta name="viewport" content="width=device-width; initial-scale=1.0; minimum-scale=1.0; maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/write.css">
</head>

<body>
<div class="top"><img class="img" width="70px"src="http://q1.qlogo.cn/g?b=qq&nk=2529855535&s=100"height="70px" ><span class="to">把你的秘密都藏到岛上来吧！</span></div>
<div class="background">
        <div class="card">
            <div class="title">好友名字</div>
            <input type="text"  name="n" id="un" required="required" placeholder="请填写好友名字或暗号" maxlength="10"/>
        </div>
        <div class="cart">
            <div class="title">你的QQ号</div>
            <input type="text" name="i" id="ml" placeholder="仅用于显示QQ头像，留空将使用本站默认头像" maxlength="12"/>
        </div>
        <div class="cart">
            <div class="tit">留言内容</div>
           <div class="textarea"> <textarea id="txt" type="text" name="t" required="required" placeholder="请填写留言内容（限200内）" maxlength="200"></textarea>
           </div>
        </div>
        <div>
            <button onclick="aj();">提交留言</button>
        </div>
        <p class="indec">注：为了维持一个和谐温暖的环境，请言语文明哦</p>
</div>

<script src="js/index.js"></script>
<script>
let aj = function (){
    let n=document.getElementById("un").value;
    let i=document.getElementById("ml").value;
    let t=cleanHtml(document.getElementById("txt").value);
    let xmlhttp;
    xmlhttp=new XMLHttpRequest();
    xmlhttp.onreadystatechange=function()
    {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
      {
        Tip(xmlhttp.responseText,1);
        document.getElementById("un").value = "";
        document.getElementById("ml").value = "";
        document.getElementById("txt").value = "";
      }
    }
    xmlhttp.open("GET","submit.php?n="+n+"&i="+i+"&t="+t,true);
    xmlhttp.send();
  }
  setInterval(()=>{
    document.getElementById("txt").maxlength = 200;
  },3000);
</script>
</body>

</html>